#######################
#   John Henderson    #
#    UC-Berkeley      #            
#       &             #
#   Sara Chatfield    #
#    UC-Berkeley      #       
#                     # 
#    Who Matches:     #
#   Replication Code  #
#                     #
#   Released          #
#     Version 1.0     #
#                     #
#   Nov 17, 2010      #
#######################


# USAGE
#########################################  
# This is replication code for Henderson, John, and Sara Chatfield. 2011. "Who Matches? Propensity Scores and Bias in the Causal Effects
# of Education on Participation," Journal of Politics.  The software, code, and data may be used, distributed, and modified freely 
# with proper attribution to both Henderson and Chatfield (2011) and Kam and Palmer (2008). 


# DESCRPITION
#########################################  
# This file is the run code that produces the 766642*6 propensity score models.  The function, 'pscore.eval', is used to 
#  implement the randomized sampling built in the 'indicator' matrix, and to estimate the ATT and ATC models based on 
#  these random covariate permutations.  The function, 'pscore.eval', estimates the following models:
#
#  (a) ATT: 1 to 1, predicted probability
#  (b) ATT: 1 to 3, predicted probability
#  (c) ATT: 1 to 1, linear predictor
#  (d) ATT: 1 to 3, linear predictor
#  (e) ATC: 1 to 3, linear predictor
#  (f) ATC: 1 to 1, linear predictor
#
# In each of these, the function also computes balance statistics for the key covariates, and all 355 dichotomized covariates,
#  as well as diagnostic statistics on the propensity score that is estimated. 
#
# WARNING: DO NOT RUN THE PSCORE MATCH ITERATIONS IN THE SAME R SESSION!  THIS WILL TAKE FOREVER! The 'indicator' object
#  is 766642 x 81.  On a fast computer, about 10 iterations may be run per minute.  This means running the full algorithm
#  may take over 50 days.  These should be separated into multiple runs (e.g. about 15 groups), run in Unix BATCH mode 
#  (i.e. nohup R < 'file.R' --vanilla &), and run on a very powerful machine (preferably one you can leave running 
#  for a few days or weeks), or even better on a cluster network.  This code is meant to illustrate the sample data generating 
#  procedure, and should be ested with a very small sample of the full indicator matrix.


library(MASS)
library(Matching)
source('funcs.R')
source('itersFuncs.R')
load("WhoMatches.Rdata")


# Propensity Score Iterations: Example 

object=apply(indicator[1:2,],1,pscore.eval)
rownames(object)=c(
"Est_PredProbATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_PredPredATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinProbATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1")
save(object,file="81_full.Rdata")


# Propensity Score Iterations: Full

object=apply(indicator,1,pscore.eval)
rownames(object)=c(
"Est_PredProbATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_PredPredATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinProbATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1")
save(object,file="81_full.Rdata")


# Propensity Score Iterations: Groups of 15

object=apply(indicator[c(1:5000),],1,pscore.eval)
rownames(object)=c(
"Est_PredProbATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_PredPredATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinProbATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1")
save(object,file="81_1_full.Rdata")


object=apply(indicator[c(5001:20000),],1,pscore.eval)
rownames(object)=c(
"Est_PredProbATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_PredPredATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinProbATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1")
save(object,file="81_2_full.Rdata")

# ....

object=apply(indicator[c(740001:766642),],1,pscore.eval)
rownames(object)=c(
"Est_PredProbATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_PredPredATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATT1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinProbATT3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC1","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1",
"Est_LinPredATC3","Pvalue","yGPA.ks.pvalue","yGPA.t.pvalue","yGen.t.pvalue","yRace1.t.pvalue","yRace2.t.pvalue","yRep.t.pvalue","yKnowledge.ks.pvalue","yKnowledge.t.pvalue","yNextSch.t.pvalue","pVote.t.pvalue","pPersuade.t.pvalue","pParticipate2.ks.pvalue","pParticipate2.t.pvalue","pEmploy.t.pvalue","pEducHH.ks.pvalue","pEducHH.t.pvalue","pEducW.ks.pvalue","pEducW.t.pvalue","pHHInc.ks.pvalue","pHHInc.t.pvalue","pOwnHome.t.pvalue","pRep.t.pvalue","pKnowledge.ks.pvalue","pKnowledge.t.pvalue","Mean Count Bal. Key","Mean Bal. Key","Var. Bal. Key","Mean Count Bal. All","Mean Bal. All","Var Bal. All","% eta >.99","% eta >.99","% eta >.90","% eta >.75","% eta >.50","% eta >.25","% eta >.1")
save(object,file="81_15_full.Rdata")

# END